# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=libkgapi
pkgver=20.04.3
pkgrel=0
pkgdesc="LibKGAPI is a KDE-based library for accessing various Google services via their public API"
arch="all !ppc64le !s390x !armhf !mips !mips64" # limited by qt5-qtwebengine
url="https://community.kde.org/KDE_PIM"
license="LGPL-2.1-only OR LGPL-3.0-only"
depends_dev="qt5-qtbase-dev qt5-qtwebengine-dev kio-dev kwindowsystem-dev kwallet-dev kcalendarcore-dev kcontacts-dev cyrus-sasl-dev"
makedepends="$depends_dev extra-cmake-modules qt5-qttools-dev"
checkdepends="xvfb-run"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkgapi-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-lang"

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib
	cmake --build build
}

check() {
	cd build
	# calendar-freebusyqueryjobtest and contacts-contactfetchjobtest are broken
	# tasks-taskfetchjobtest fails on the builders
	# contacts-contactfetchjobtest: https://gitlab.alpinelinux.org/alpine/aports/-/issues/11787
	CTEST_OUTPUT_ON_FAILURE=TRUE xvfb-run ctest -E "(tasks-taskfetchjob|calendar-freebusyqueryjob|contacts-contactfetchjob)test"
}

package() {
	DESTDIR="$pkgdir" cmake --build build --target install
}
sha512sums="2867e9b3492f721068e43dfd6d58ddccc0d7378e0f5613fad135c380060ccbf2906b1cb187ec65ae3800cf3ba12329a3d7627f6aa1f29fe94a67845b96362d66  libkgapi-20.04.3.tar.xz"
